<template>
<div class="customer-details-page">
    <div  style="position:absolute;z-index:100;margin-top:12px;margin-left:20px">
        <!-- <a-button type="primary" size="small"> <a-icon type="left" /></a-button> -->
              <a-tag style="cursor:pointer " color="#39f" @click="goBack"><a-icon type="arrow-left" />
              <span>返回</span>
               </a-tag>
       
    </div>
    <!-- 客户资料切换页 -->
    <a-tabs @change="getTabs" :activeKey="currentActiveKey" type="line" :forceRender="false" style="background: #FFFFFF;overflow:auto;">
        <!-- <div>返回</div> -->
        <a-tab-pane key="customerItem" tab="客户资料">
            <a-card class="box-card" title="基础资料">
                <div style="position:absolute;right:25px;top:20px;cursor: pointer;">
                    <div v-if="!showEditDetailData" @click="editDetailData">
                        <a-icon theme="twoTone" two-tone-color="#3399ff" type="edit" style="margin-right: 6px;" />
                        <span style="color: #3399ff">编辑</span>
                    </div>
                    <div v-else>
                        <span style="color: #3399ff" @click="saveDetailData">保存</span>
                        <span style="color: #3399ff;margin-left: 10px;" @click="cancelDetailData">取消</span>
                    </div>
                </div>
                <a-descriptions margin="0 2px" :column="4" :data="customerDetailsForm">
                    <a-descriptions-item label="客户姓名">
                        <span v-if="!showEditDetailData"> {{ customerDetailsForm.name ?customerDetailsForm.name:'-' }}</span>
                        <template v-else>
                            <a-form :form="customerForm" v-if="receiveListBthPermission">
                                <a-form-item>
                                    <a-input style="max-width: 150px;" v-decorator="['name',{ initialValue:customerDetailsForm.name}]" placeholder="输入姓名" />
                                </a-form-item>
                            </a-form>
                            <span v-else>{{ customerDetailsForm.name ?customerDetailsForm.name:'-' }}</span>
                        </template>

                    </a-descriptions-item>
                    <a-descriptions-item label="客户卡号">{{ customerDetailsForm.card_no }}</a-descriptions-item>
                    <a-descriptions-item label="区域来源">{{ customerDetailsForm.area_id }}</a-descriptions-item>
                    <a-descriptions-item label="信息来源">
                        <span class="g-no-wrap-hidden" style="max-width: 160px;">{{ customerDetailsForm.info_source }}</span>
                    </a-descriptions-item>
                    <a-descriptions-item label="客户性别">
                        <a-form :form="customerForm">
                            <a-form-item>
                                <a-select allow-clear v-decorator="['sex', { initialValue:customerDetailsForm.sex }] " style="width: 120px;" placeholder="请选择性别" v-if="showEditDetailData">
                                    <a-select-option v-for="(item,index) in [{name:'男',id:0},{name:'女',id:1}]" :key="index" :value="item.id">{{ item.name }}</a-select-option>
                                </a-select>
                            </a-form-item>
                        </a-form>
                        <span v-if="!showEditDetailData">{{ customerDetailsForm.sex?customerDetailsForm.sex:'-' }}</span>
                    </a-descriptions-item>
                    <a-descriptions-item label="客户年龄">
                        <a-form :form="customerForm">
                            <a-form-item>
                                <a-input style="width: 120px;" v-show="showEditDetailData" v-decorator="['age',{ initialValue:customerDetailsForm.age}]" placeholder="输入年龄" />
                            </a-form-item>
                        </a-form>
                        <span v-show="!showEditDetailData">{{ customerDetailsForm.age?customerDetailsForm.age:'-' }}</span>
                    </a-descriptions-item>
                    <a-descriptions-item label="客户生日">
                        <a-form :form="customerForm">
                            <a-form-item>
                                <a-date-picker :disabledDate="disabledDate" v-decorator="['birthday',{ initialValue:customerDetailsForm.birthday?moment(customerDetailsForm.birthday,'YYYY-MM-DD'):null } ]" format="YYYY-MM-DD" style="width: 130px;" placeholder="选择日期" v-if="showEditDetailData" />
                            </a-form-item>
                        </a-form>
                        <span v-if="!showEditDetailData">{{ customerDetailsForm.birthday ?customerDetailsForm.birthday:'-'}}</span>
                    </a-descriptions-item>
                    <a-descriptions-item label="家庭地址">
                        <a-form :form="customerForm">
                            <a-form-item>
                                <a-input style="width: 150px;" v-if="showEditDetailData" v-decorator="['homeAddr',{ initialValue:customerDetailsForm.home_addr}]" placeholder="输入地址" />
                            </a-form-item>
                        </a-form>
                        <span v-if="!showEditDetailData">{{ customerDetailsForm.home_addr?customerDetailsForm.home_addr:'-' }}</span>
                    </a-descriptions-item>
                    <a-descriptions-item label="备注">
                        <a-form :form="customerForm">
                            <a-form-item>
                                <a-input v-if="showEditDetailData" v-decorator="['remark',{ initialValue:customerDetailsForm.remark}]" placeholder="输入内容" />
                            </a-form-item>
                        </a-form>
                        <span v-if="!showEditDetailData"> {{ customerDetailsForm.remark ?customerDetailsForm.remark:'-' }}</span>
                    </a-descriptions-item>
                </a-descriptions>
            </a-card>
            <!--联系方式-->
            <a-card class="box-card" title="联系方式">
                <contact-table @reLoad="reLoad" :customer="customerDetailsForm" :customerId="customerId" :ContactList="customerDetailsForm.ContactList" />
            </a-card>
            <!--客户归属-->
            <a-card class="box-card" title="客户归属">
                <div style="position:absolute;right:25px;top:20px;cursor: pointer;">
                    <div v-if="!customerEditor" @click="exchangeCE">
                        <a-icon theme="twoTone" two-tone-color="#3399ff" type="edit" style="margin-right: 6px;" />
                        <span style="color: #3399ff">编辑</span>
                    </div>
                    <div v-else>
                        <span style="color: #3399ff" @click="saveCSbelong">保存</span>
                        <span style="color: #3399ff;margin-left: 10px;" @click="exchangeCE">取消</span>
                    </div>
                </div>

                <a-descriptions margin="0 2px" :column="4" :data="customerBelongForm">
                    <a-descriptions-item label="开发员">{{ customerDetailsForm.developer?customerDetailsForm.developer:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="所属咨询师">{{ customerDetailsForm.consultMan?customerDetailsForm.consultMan:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="客服专员">{{ customerDetailsForm.customerService?customerDetailsForm.customerService:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="渠道名称">{{ customerDetailsForm.channelName?customerDetailsForm.channelName:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="客户经理">{{customerBelongForm.kfjl?customerBelongForm.kfjl:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="介绍登记人">{{ customerBelongForm.jsdjr?customerBelongForm.jsdjr:'-' }}</a-descriptions-item>
                    <a-descriptions-item v-if="!customerEditor" label="介绍人">{{ customerBelongForm.jsr?customerBelongForm.jsr:'-'}}</a-descriptions-item>
                    <a-descriptions-item v-if="!customerEditor" label="介绍人卡号">{{ customerBelongForm.jsrkh ?customerBelongForm.jsrkh:'-' }}</a-descriptions-item>
                    <a-descriptions-item v-if="customerEditor" label="介绍人">
                        <a-input size="small" v-model="customerBelongForm.jsr" :disabled="true" allow-clear placeholder="介绍人" />
                    </a-descriptions-item>
                    <a-descriptions-item v-if="customerEditor" label="介绍人卡号">
                        <a-input-search :loading="searchLoading"
                            @search="searchUser"
                            allow-clear
                            enter-button 
                            @change="clearSpace" 
                            size="small" 
                            v-model="customerBelongForm.jsrkh"
                            placeholder="请输入介绍人卡号" />
                    </a-descriptions-item>
                    <a-descriptions-item label="无创所属医生">{{ customerBelongForm.wcssys?customerBelongForm.wcssys:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="口腔所属医生">{{ customerBelongForm.kqssys?customerBelongForm.kqssys:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="整形所属医生">{{ customerBelongForm.zxssys?customerBelongForm.zxssys:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="皮肤所属医生">{{customerBelongForm.pfssys?customerBelongForm.pfssys:'-'}}</a-descriptions-item>
                </a-descriptions>
            </a-card>
            <!--最新动态-->
            <a-card class="box-card" title="最新动态">
                <a-descriptions margin="0 2px" :column="4" :data="customerDetailsForm">
                    <a-descriptions-item label="登记时间"> {{customerDetailsForm.regist_date?customerDetailsForm.regist_date:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="初诊时间">{{customerDetailsForm.first_visit_time?customerDetailsForm.first_visit_time:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="首次消费时间">{{customerDetailsForm.first_cost_time?customerDetailsForm.first_cost_time:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="首次成交时间">{{customerDetailsForm.first_deal_time?customerDetailsForm.first_deal_time:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="最近回访时间">{{customerDetailsForm.last_return_visit_time?customerDetailsForm.last_return_visit_time:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="最近来院时间">{{customerDetailsForm.last_come_time?customerDetailsForm.last_come_time:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="最近消费时间">{{customerDetailsForm.last_cost_time?customerDetailsForm.last_cost_time:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="最近治疗时间">{{customerDetailsForm.last_treat_time?customerDetailsForm.last_treat_time:'-'}}</a-descriptions-item>
                </a-descriptions>
            </a-card>
            <!--客户档案-->
            <a-card class="box-card" title="客户档案">
                <a-descriptions margin="0 2px" :column="4" :data="customerFilesForm">
                    <a-descriptions-item label="全院档案号">{{ customerFilesForm.qyddh ?customerFilesForm.qyddh:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="整形档案">{{ customerFilesForm.zxddh ?customerFilesForm.zxddh:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="皮肤档案">{{customerFilesForm.pfddh ?customerFilesForm.pfddh:'-' }}</a-descriptions-item>
                    <a-descriptions-item label="无创档案">{{ customerFilesForm.wcddh ?customerFilesForm.wcddh:'-'}}</a-descriptions-item>
                    <a-descriptions-item label="口腔档案">{{ customerFilesForm.kqddh ?customerFilesForm.kqddh:'-'}}</a-descriptions-item>
                </a-descriptions>
            </a-card>

            <!-- <a-card style="padding-left:0px"> -->
                <a-row >
                    <a-col :md="24" :lg="11" class="header-details header-details-left" style="border-bottom:0px;border-right:2px solid #F0F2F5">
                        <!-- @back="goBack" -->
                        <a-page-header   title="客户资料" />
                        <a-row>
                            <a-col :span="7">
                                <div class="g-flex-col g-y-center g-x-center">
                                    <a-avatar v-if="customerDetailsForm.sex=='男'" :src="require('@/assets/man.png')" :size="58" />
                                    <a-avatar v-else :src="require('@/assets/woman.png')" :size="58" />
                                    <div style="margin-top: 10px;  text-align: center">
                                        <a style=" font-size: 16px">
                                            <b>{{ customerDetailsForm.name }}</b>
                                        </a>
                                    </div>
                                </div>
                            </a-col>
                            <a-col :span="17" style="height: 100%">
                                <div style="font-size: 16px;">
                                    <template>
                                        <a-descriptions :column="3">
                                            <a-descriptions-item label="卡号">{{ customerDetailsForm.card_no }}</a-descriptions-item>
                                            <a-descriptions-item label="客户状态">{{ customerDetailsForm.clientState?customerDetailsForm.clientState:'-' }}</a-descriptions-item>
                                            <a-descriptions-item label="客户等级">{{ customerDetailsForm.client_level }}</a-descriptions-item>
                                        </a-descriptions>
                                    </template>
                                </div>
                            </a-col>
                        </a-row>
                    </a-col>
                    <a-col :md="24" :lg="11" class="header-details header-details-right" style="border-bottom:0px">
                        <a-row>
                            <a-col :span="24">
                                <div style="margin:15px 0 0 20px;font-size: 20px;font-weight: bold">消费/账目情况</div>
                            </a-col>
                        </a-row>
                        <a-row>
                            <a-col :span="6"></a-col>
                            <a-col :span="6">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-20"> {{ customerAmtForm?customerAmtForm.depositAmt:'-'}} </b>
                                    <span class="g-c-999 g-f-12" style="position: relative"> 预存款剩余
                                        <a-button v-if="chargeBthPermission" type="primary" @click="showRecharge()" style="position: absolute;width: 50px;right: -72px;bottom: -3px;height: 28px;font-size: 12px;padding:0;cursor:pointer;">
                                            充值
                                        </a-button>
                                    </span>
                                
                                </div>
                            </a-col>

                            <a-col :span="6">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-20"> {{ customerAmtForm?customerAmtForm.hospitalAmt:'-' }}</b>
                                    <span class="g-c-999 g-f-12"> 押金剩余</span>
                                </div>
                            </a-col>
                            <a-col :span="6">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-20"> {{ customerAmtForm?customerAmtForm.usedIntegral :'-' }}</b>
                                    <span class="g-c-999 g-f-12"> 积分剩余</span>
                                </div>
                            </a-col>
                        </a-row>
                        <a-row>
                            <a-col :span="7">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-30">{{ customerAmtForm?customerAmtForm.itemAmt:'-' }} </b>
                                    <span class="g-c-999 g-f-12"> 项目累计消费</span>
                                </div>
                            </a-col>
                            <a-col :span="17"></a-col>
                        </a-row>
                        <a-row>
                            <a-col :span="6"></a-col>
                            <a-col :span="6">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-20">{{ customerAmtForm?customerAmtForm.coinBalance:'-'}} </b>
                                    <span class="g-c-999 g-f-12"> 美丽基金剩余</span>
                                </div>
                            </a-col>
                            <a-col :span="6">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-20">{{ customerAmtForm?customerAmtForm.valueGold:'-' }} </b>
                                    <span class="g-c-999 g-f-12"> 增值金剩余</span>
                                </div>
                            </a-col>
                            <a-col :span="6">
                                <div class="g-flex-col g-y-center">
                                    <b class="g-c-333 g-f-20">{{ customerAmtForm?customerAmtForm.usableTicketAmt:'-' }} </b>
                                    <span class="g-c-999 g-f-12"> 消费券剩余</span>
                                </div>
                            </a-col>
                        </a-row>
                    </a-col>
                </a-row>
                <recharge :obModal="obModal" @getlist="getList"></recharge>

            <!-- </a-card> -->
        </a-tab-pane>

        <a-tab-pane key="triage" tab="分诊记录">
            <tab-triage-record :customerId="customerId" />
        </a-tab-pane>

        <a-tab-pane key="consultation" tab="咨询情况">
            <tab-consultation :customerDetailsForm="customerDetailsForm" :customerId="customerId" />
        </a-tab-pane>

        <a-tab-pane key="returnVisit" tab="回访情况">
            <tab-return-visit-form :customerDetailsForm="customerDetailsForm" :customerId="customerId" />
        </a-tab-pane>

        <a-tab-pane key="consumption" tab="客户消费">
            <tab-consumption :customerId="customerId" />
        </a-tab-pane>

        <a-tab-pane key="consumptionDetail" tab="消费明细">
            <tab-consumption-detail :customerId="customerId" />
        </a-tab-pane>

    </a-tabs>

    
</div>
</template>

<script>
import {
    STable,
    SuperTable
} from '@/components'
import hasNoData from '@/assets/hasNoData.png'
import recharge from '../customerList/component/Recharge.vue'
import TabTriageRecord from '@/views/customer/customerDetails/components/TabTriageRecord/TabTriageRecord'
import TabConsultation from '@/views/customer/customerDetails/components/TabConsultation/TabConsultation'
import TabReturnVisitForm from '@/views/customer/customerDetails/components/TabReturnVisitForm/TabReturnVisitForm'
import ContactTable from '@/views/customer/customerDetails/components/ContactTable'
import TabConsumption from '@/views/customer/customerDetails/components/TabConsumption/TabConsumption'
import TabConsumptionDetail from '@/views/customer/customerDetails/components/TabConsumptionDetail/TabConsumptionDetail'
import moment from 'moment'
import {
    customerFileNumberByCustomerId,
    customerUserByCustomerId,
    getCustomerAmtByCustomerId,
    getCustomerProfileByCustomerId,
    updateDetails,

} from '@/api/customer/customer'
import {
    getConsulationListByCardNo,
} from '@/api/modular/main/customer/customerConsultation'

export default {
    components: {
        STable,
        SuperTable,
        ContactTable,
        recharge,
        TabTriageRecord,
        TabConsultation,
        TabReturnVisitForm,
        TabConsumption,
        TabConsumptionDetail
    },
    data() {
        return {
            obModal: {
                title: '预存款充值',
                visible: false,
            },
            customerForm: this.$form.createForm(this),
            customerId: '',
            editOriginDetailsForm: {},
            editParams: {},
            showEditDetailData: false,
            customerEditor: false,
            currentActiveKey: 'customerItem', //当前激活的选项卡
            customerDetailsForm: {}, // 客户详细资料
            customerFilesForm: {}, // 客户档案
            customerBelongForm: {}, // 客户归属
            csBelong:{},
            customerAmtForm: {}, //消费账目
            hasNoData: hasNoData,
            id: '',
            card_no: '',
            // 客户表格数据
            customerTable: [],
            // 弹出层标题
            title: '',
            list: [], // 客户列表
            consumptionForm: {},
            //消费明细
            count: 2,
            searchLoading: false
        }
    },
    computed: {
        //充值按钮按钮查看权限，如果是导医或者电网，则隐藏
        chargeBthPermission() {
            const admintype = this.$store.state.user.admintype
            if (admintype === 1) {
                return true
            }
            if (this.hasPerm('customer:netConsultation:list') || this.hasPerm('receive:receiveList')) {
                return false
            }
            return true
        },
        //修改客户姓名，如果是导医，可以修改
        receiveListBthPermission() {
            if (this.hasPerm('receive:receiveList')) {
                return true
            }
            return false
        }
    },
    mounted() {
        console.log(this.$route.query)
        this.customerId = this.$route.query.id
        this.card_no = this.$route.query.card_no
        if (!this.$store.state.app.multiTab) {
            // console.log('这里是首次加载')
            this.getCustomer()
        }
    },

    watch: {
        $route() {
            this.customerEditor=false
            this.customerId = this.$route.query.id
            this.card_no = this.$route.query.card_no
            this.currentActiveKey='customerItem'
            if (this.$route.query.id && this.$route.query.card_no) {           
                this.getCustomer()
            }
        },
    },

    activated() {
        if (this.$store.state.app.multiTab) {
            // console.log('这里是激活缓存',this.$store.state.app)
            console.log(this.$route.query.id)
            this.customerId = this.$route.query.id
            this.card_no = this.$route.query.card_no
            this.getCustomer()
        }
    },

    methods: {
        clearSpace(e){
             // console.log("e",e.target.value)
             this.customerBelongForm.jsrkh=e.target.value.replace(/\s+/g,'')
        },
        saveCSbelong(){
            if(!this.customerBelongForm.jsrkh){
                this.$message.info("介绍人卡号为空")
                return
            }
            if(this.customerBelongForm.jsr){
            //   let otherData=this.customerDetailsForm
              let param={
                jsr:this.customerBelongForm.jsr,
                introducerId:this.customerBelongForm.id,
                customerId:this.$route.query.id,
             
              }      

              updateDetails({...param}).then(res=>{
                if (res.code == 200) {
                  this.customerEditor=!this.customerEditor
                  this.$message.success('修改成功')

                }else{
                  this.customerEditor=!this.customerEditor        
                }
              })
            }else{
                 this.$message.info("介绍人姓名为空")
            }
        },
        searchUser() {
            this.searchLoading = true   
            if (this.customerBelongForm.jsrkh) {
                getConsulationListByCardNo(this.customerBelongForm.jsrkh).then(res => {
                    this.searchLoading = false
                    console.log('res1',res)
                    if(res.rows.length>0){
                          this.customerBelongForm.jsr=res.rows[0].name
                          this.customerBelongForm.id=res.rows[0].customerId
                    }
                  
                })
            } else {
                this.searchLoading = false

                this.$message.info("介绍人卡号为空")
            }
        },

        showRecharge() {
            console.log(this.customerDetailsForm)
            this.obModal.visible = true
            this.obModal.title = '预存款充值'
            this.obModal.customerName = this.customerDetailsForm.name
            this.obModal.cardNo = this.customerDetailsForm.card_no // 卡号
            this.obModal.customerId = this.customerDetailsForm.ContactList[0].customerId
            this.obModal.phone = this.customerDetailsForm.ContactList[0].contactContent
        },
        getList() {
            this.getCustomer()
        },
        reLoad() {
            this.getCustomer()
        },

        /**
         * 日期格式化
         * **/
        moment,
        /**
         * 客户归属修改
         */
        exchangeCE() {
            this.customerEditor = !this.customerEditor
            // 取消
            if(!this.customerEditor){
              this.getCustomer()
            } 
        },
        /**
         * 修改客户资料
         * **/
        editDetailData() {
            this.showEditDetailData = true
            this.editOriginDetailsForm = JSON.parse(JSON.stringify(this.customerDetailsForm))
        },
        /**
         * 取消编辑结果
         * **/
        cancelDetailData() {
            this.showEditDetailData = false
            this.customerDetailsForm = this.editOriginDetailsForm
        },
        /**
         * 保存编辑结果
         * **/
        saveDetailData() {
            // console.log('编辑后的结果为',this.editParams)
            const {
                customerForm: {
                    validateFields
                }
            } = this
            validateFields((errors, values) => {
                console.log('提交编辑表单111为', values)
                values.customerId = this.customerId
                if (values.birthday) {
                    values.birthday = moment(values.birthday).format('YYYY-MM-DD')
                } else {
                    values.birthday = null
                }
                if (values.sex) {
                    if (values.sex === '女') {
                        values.sex = 1
                    }
                    if (values.sex === '男') {
                        values.sex = 0
                    }
                }
                console.log('提交编辑表单222为', values)
                updateDetails(values).then(res => {
                    if (res.code == 200) {
                        this.$message.success(res.data)
                        getCustomerProfileByCustomerId(this.customerId).then(response => {
                            this.customerDetailsForm = response.data
                            this.showEditDetailData = false
                        })
                    } else {
                        this.$message.info(res.message)
                    }

                })
            })
        },
        /**
         * 日期改变
         * **/
        changeDate(value) {
            console.log('选中date', value)
            let formatDate = null
            if (value) {
                formatDate = moment(value).format('YYYY-MM-DD')
            }

            this.editParams.birthday = formatDate
        },

        onCellChange(key, dataIndex, value) {
            const dataSource = [...this.dataSource]
            const target = dataSource.find(item => item.key === key)
            if (target) {
                target[dataIndex] = value
                this.dataSource = dataSource
            }
        },

        /** 获取客户信息 **/
        getCustomer() {
            getCustomerProfileByCustomerId(this.customerId).then(response => {
                // console.log('详细资料',response)
                this.customerDetailsForm = response.data
            })
            getCustomerAmtByCustomerId(this.customerId).then(res => {
                // console.log('客户消费账目',res)
                this.customerAmtForm = res.data
            })
            customerUserByCustomerId(this.customerId).then(res => {
                // console.log('客户归属',res)
                this.customerBelongForm = res.data
            })
            customerFileNumberByCustomerId(this.customerId).then(res => {
                // console.log('客户档案',res)
                this.customerFilesForm = res.data
            })
        },
        goBack() {
            //点击跳转至上次浏览页面
            this.$router.go(-1)
        },
        disabledDate(current) {
            // 不可选过去时间
            // return current < moment().add(-1, 'd');
            // 不可选未来时间
            return current && current > Date.now()
        },

        //点击tab
        getTabs(tab, event) {
            if (tab == 'customerItem') {
                this.currentActiveKey = 'customerItem'
            }
            if (tab == 'consultation') {
                this.currentActiveKey = 'consultation'
                return
            }
            if (tab == 'returnVisit') {
                this.currentActiveKey = 'returnVisit'
                return
            }
            if (tab == 'triage') {
                this.currentActiveKey = 'triage'
                // this.loadTriageData()
                return
            }
            if (tab == 'returnVisit') {
                this.currentActiveKey = 'returnVisit'
                // this.returnVisitRecordTable()
                return
            }

            if (tab == 'consumption') {
                this.currentActiveKey = 'consumption'
                // this.loadConsumptionData()
                return
            }
            if (tab == 'consumptionDetail') {
                this.currentActiveKey = 'consumptionDetail'
                // this.loadConsumptionDetailsData()
                return
            }
        }
    }
}
</script>

<style lang="less" scoped>
/deep/ .s-table-tool {
    margin: 15px 0;
}

.header-details {
    background: #FFFFFF;
    height: 250px;
    border-bottom: 16px #F0F2F5 solid;
}

.header-details-left {
    border-right: 16px #F0F2F5 solid;
}

/deep/ .ant-card-body {
    padding: 0 24px;
}

.editable-row-operations a {
    margin-right: 8px;
}

/deep/ .ant-card-head-title {
    font-weight: bold;
}

.customer-details-page /deep/ .ant-card-head {
    border-bottom: none;
}

.customer-details-page /deep/ .ant-tabs-bar {
    margin: 0;
    /*border-bottom: none;*/
}

.customer-details-page /deep/ .ant-tabs-nav .ant-tabs-tab {
    margin: 0 32px 0 10px;
}

.customer-details-page /deep/  .ant-tabs-nav-scroll {
    padding-left: 90px;
}

.children-table {
    width: 99%;
    margin: 10px auto;
    color: #333333;
    border-color: #cccccc;
    border-collapse: collapse;
}

.children-table tr {
    height: 40px;
}

.children-table tr th {
    padding-left: 20px;
    background: #fafafa;
}

.children-table tr td {
    padding-left: 20px;
    background: #ffffff;
}

.no-children-table {
    text-align: center;
}

.no-children-table-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

/deep/ .ant-tabs-nav .ant-tabs-tab-active {
    font-weight: 800;
}

/deep/ .ant-card-bordered {
    border: none;
    border-bottom: 1px solid #e8e8e8;
}

/deep/ .ant-card-bordered:nth-last-child {
    border-bottom: none;
}

/deep/ .ant-tabs .ant-tabs-top-content,
.ant-tabs .ant-tabs-bottom-content {
    margin: 0 auto;
}

.ant-table-placeholder {
    border-bottom: none;
    
}

/deep/ .ant-table-wrapper {
    margin: 16px 24px 0;
}

/deep/ .ant-table-expanded-row ant-table-expanded-row-level-1 td {
    /*padding: 51px 0 !important;*/
    display: none !important;
}

/deep/ .ant-table-row ant-table-row-level-0 {
    /*padding: 51px 0 !important;*/
    display: none !important;
}

/deep/ .ant-table-fixed-right .ant-table-expanded-row {
    display: none;
}

/deep/ .ant-form-item {
    margin-bottom: 8px;
}
</style>
